<template>
	<view class="container">
		<u-cell-group>
			<u-cell title="客户名称" :value="info.nickname"></u-cell>
			<u-cell title="手机号" :value="info.mobile"></u-cell>
			<u-cell title="邮箱" :value="info.email"></u-cell>
			<u-cell title="性别" :value="info.gender_text"></u-cell>
			<u-cell title="客户来源" :value="info.scource.name"></u-cell>
			<u-cell title="成交状态" :value="info.deal_text"></u-cell>
			<u-cell title="地区" :value="info.address"></u-cell>
			<u-cell title="认证状态" :value="info.auth_text"></u-cell>
			<u-cell title="创建时间" :value="info.createtime"></u-cell>
			<u-cell title="头像">
				<text slot="value">
					<u--image :src="info.avatar_url" shape="circle" width='50px' height='50px'></u--image>
				</text>
			</u-cell>
		</u-cell-group>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				busid: 0,
				info: {
					source: {},
					district:{},
					city:{},
					province:{}
					
				}
			}
		},
		onLoad(options) {
			this.busid = options.busid ?? 0
			this.getprivateseaInfo()
		},
		onReady() {
			this.$u.auth.check();
		},
		methods: {
			async getprivateseaInfo() {
				let result = await this.$u.api.manage.privateseaInfo({
					id: this.busid
				})
				if (result.code == 1) {
					this.info = result.data
					this.info.address = null;
					if (this.info.district && this.info.district.code) {
						this.info.address = this.info.district.province + '-' + this.info.district.city + '-' + this
							.info.district.district
					} else if (this.info.city && this.info.city.code) {
						this.info.address = this.info.district.province + '-' + this.info.district.city
					} else if (this.info.province && this.info.province.code) {
						this.info.address = this.info.district.province
					}
				}
			}
		}
	}
</script>

<style>
	.container {
		padding: 8px;
	}
</style>